home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d7 / dial32.arc / DIAL.BAS next >
BASIC Source File  |  1989-04-25  |  35KB  |  1,469 lines

  1. 'Sun  Apr 23, 1989   1:36:45 pm 
  2. '****************************************************************************
  3. '* 04/15/89                                                         VER 3.2 *
  4. '*                     ****  DIAL PHONE DIALER  ****                        *
  5. '*                              Written in                                  *
  6. '*                             QUICKBASIC 4.5                               *
  7. '*                                                                          *
  8. '* (c) 1989 by DAVID WESSON, PhD.  238 S. Quaker La. W.Hartford, CT 06119   *
  9. '****************************************************************************
  10. '
  11. ' $INCLUDE: 'dial.dec'
  12. '
  13. '========================== MAIN PROGRAM STARTS HERE ========================
  14.      initialize
  15.      readcommandline
  16.      menuroutine
  17.      goodbye
  18. '======================= DECLARED SUBROUTINES START HERE ====================
  19.  
  20. SUB addnames
  21.     pagehead "DIRECTORY BUSINESS"
  22.     prompt "Enter Blank line or [Esc] to end input."
  23.     startrec = numrecs
  24.     DO
  25.         numrecs = numrecs + 1
  26.         d$(1) = "ADDING names and phone numbers to Directory."
  27.         d$(2) = "Enter NAME  : " + STRING$(20, 254)
  28.         d$(3) = "Enter NUMBER: " + STRING$(15, 254)
  29.         d$(4) = "Use  - hyphens for pauses only."
  30.         dialog 8, "ENTER NAMES"
  31.         COLOR back, fore
  32.         LOCATE 20, 33
  33.         keyin 20
  34.         IF in$ = "" OR in$ = esc$ THEN numrecs = numrecs - 1: EXIT DO
  35.         name$(numrecs) = UCASE$(in$)
  36.         IF in$ = "" OR in$ = esc$ THEN numrecs = numrecs - 1: EXIT DO
  37.         LOCATE 21, 33
  38.         keyin 15
  39.         number$(numrecs) = in$
  40.         IF in$ = "" OR in$ = esc$ THEN numrecs = numrecs - 1: EXIT DO
  41.     LOOP UNTIL numrecs = 480
  42.     IF numrecs = startrecs THEN EXIT SUB
  43.     sortdatafile
  44.     writedatafile
  45. END SUB
  46.  
  47. SUB changedir
  48.     pagehead "CHANGE DIRECTORY"
  49.     IF phonelist$ = "" THEN
  50.         prompt "Enter filename of DIRECTORY: " + STRING$(12, 254)
  51.         COLOR fore, back
  52.         LOCATE 25, 48
  53.         keyin 25
  54.         IF in$ = "" OR in$ = esc$ THEN EXIT SUB
  55.         phonelist$ = in$
  56.         clearall
  57.         restart
  58.     END IF
  59.     datafile$ = path$ + phonelist$
  60.     phonelist$ = ""
  61.     checkdatafile
  62.     viewdir
  63. END SUB
  64.  
  65. SUB checkdatafile
  66.  
  67. Check.for.datafile:
  68.     datafile = FREEFILE
  69.     OPEN datafile$ FOR RANDOM AS datafile
  70.     IF LOF(datafile) = 0 THEN
  71.         CLOSE datafile
  72.         KILL datafile$
  73.         prompt "No Directory file by that name found. Hit a key or button."
  74.         inbutton
  75.         makenewdir
  76.     END IF
  77.     CLOSE datafile
  78.  
  79. Check.Top.Line:
  80.     opendatafile
  81.     INPUT #datafile, v
  82.     IF v < 3.2 THEN
  83.         CLOSE #datafile
  84.         opendatafile
  85.         LINE INPUT #datafile, x$
  86.         tempfile = FREEFILE
  87.         OPEN tempfile$ FOR OUTPUT AS tempfile
  88.         WRITE #tempfile, version, port$, tone$, initial$, prefix$, path$, fore, back, high, freq, mouseon
  89.         WHILE NOT EOF(datafile)
  90.             LINE INPUT #datafile, l$
  91.             PRINT #tempfile, l$
  92.         WEND
  93.         CLOSE
  94.         KILL datafile$
  95.         NAME tempfile$ AS datafile$
  96.         LOCATE 15, 15: PRINT "New datafile format installed, reset port settings."
  97.         readdatafile
  98.         setport
  99.     END IF
  100.     CLOSE
  101.     readdatafile
  102. END SUB
  103.  
  104. SUB checkinput
  105.     getmouse
  106.     SELECT CASE button
  107.         CASE 1: in$ = enter$
  108.         CASE 2: in$ = esc$
  109.         CASE ELSE: in$ = UCASE$(INKEY$)
  110.     END SELECT
  111. END SUB
  112.  
  113. SUB clearall
  114.     pagehead ""
  115.     COLOR fore, back
  116.     VIEW PRINT 5 TO 24
  117.     CLS
  118.     VIEW PRINT
  119. END SUB
  120.  
  121. SUB click
  122.     IF freq <> 0 THEN SOUND freq, 1
  123. END SUB
  124.  
  125. SUB clock
  126.     row = CSRLIN
  127.     col = POS(0)
  128.     COLOR back, fore
  129.     LOCATE 1, 68: PRINT newtime$(TIME$)
  130.     LOCATE row, col
  131. END SUB
  132.  
  133. SUB deletename
  134.     pagehead "DIRECTORY BUSINESS"
  135.     DO
  136.         prompt "Enter FULL or PARTIAL NAME to be deleted, or [Esc] to EXIT."
  137.         d$(2) = "Enter FULL or PARTIAL NAME: " + STRING$(20, 254)
  138.         dialog 5, "DELETE NAME"
  139.         LOCATE 20, 44
  140.         keyin 20
  141.         IF in$ = "" OR in$ = esc$ THEN EXIT DO
  142.         name$ = UCASE$(in$)
  143.         found = 0: x = 0
  144.         DO UNTIL x = numrecs
  145.             x = x + 1
  146.             IF LEFT$(UCASE$(name$(x)), LEN(name$)) = name$ THEN
  147.                 LOCATE 20, 44: PRINT name$(x)
  148.                 found = 1
  149.                 prompt "Hit any key or left button to confirm delete, or [Esc] to ABORT."
  150.                 inbutton
  151.             END IF
  152.             IF in$ = esc$ THEN EXIT SUB
  153.             name$(x) = name$(x + found)
  154.             number$(x) = number$(x + found)
  155.         LOOP
  156.         numrecs = numrecs - found
  157.         IF found = 0 THEN prompt "No listing by that name in Directory. Hit a key or button.": inbutton
  158.    LOOP
  159.    writedatafile
  160. END SUB
  161.  
  162. SUB demondial
  163.     demon = 1
  164.     DO
  165.         try = try + 1
  166.         placecall
  167.         IF call$ = "" THEN EXIT DO
  168.     LOOP
  169.     try = 0
  170.     demon = 0
  171.     call$ = ""
  172.     dial$ = ""
  173. END SUB
  174.  
  175. SUB dialheader
  176.     COLOR fore, back
  177.     LOCATE 2, 1
  178.     PRINT SPACE$(160);
  179.     LOCATE 3, 1
  180. END SUB
  181.  
  182. SUB dialog (margin, head$)
  183.     COLOR high, fore
  184.     LOCATE 18, 10
  185.     PRINT SPACE$(30 - (LEN(head$) / 2)); head$; SPACE$(70 - POS(0))
  186.     COLOR back, fore
  187.     FOR x = 1 TO 4
  188.           LOCATE 18 + x, 9
  189.           PRINT CHR$(176); SPACE$(1 + margin); d$(x); SPACE$(70 - POS(0))
  190.     NEXT x
  191.     LOCATE 23, 9: PRINT STRING$(60, 176)
  192.     FOR x = 1 TO 4
  193.         d$(x) = ""
  194.     NEXT x
  195. END SUB
  196.  
  197. SUB dirhead
  198.       a$ = SPACE$(22): LSET a$ = datafile$
  199.       b$ = SPACE$(15): LSET b$ = initial$
  200.       c$ = SPACE$(15): LSET c$ = prefix$
  201.       LOCATE 4, 1
  202.       COLOR back, fore
  203.       PRINT SPACE$(1); a$; dev$; port$; dev$;
  204.       PRINT tone$; dev$; b$; dev$; "* = "; c$; SPACE$(1)
  205.       COLOR fore, back
  206. END SUB
  207.  
  208. FUNCTION dosvers
  209.     t1 = &H3000: t2 = 0: t3 = 0: t4 = 0
  210.     inregs.ax = t1: inregs.bx = t2: inregs.cx = t3: inregs.dx = t4
  211.     CALL interrupt(&H21, inregs, outregs)
  212.     t1 = outregs.ax: t2 = outregs.bx: t3 = outregs.cx: t4 = outregs.dx
  213.     al = t1 - ((FIX(t1 / 256)) * 256)
  214.     ah = FIX(t1 / 256)
  215.     dosvers = al + (ah / 100)
  216. END FUNCTION
  217.  
  218. SUB editname
  219.     pagehead "DIRECTORY BUSINESS"
  220.     DO
  221.         found = 0
  222.         prompt "Enter FULL or UNIQUE PARTIAL NAME, or Blank or [Esc] to EXIT."
  223.         d$(1) = "NAME or PARTIAL NAME   : " + STRING$(20, 254)
  224.         d$(3) = "NEW NAME or [Return]   : " + STRING$(20, 254)
  225.         d$(4) = "NEW NUMBER or [Return] : " + STRING$(15, 254)
  226.         dialog 6, "EDIT DIRECTORY ENTRY"
  227.         LOCATE 19, 42
  228.         keyin 20
  229.         IF in$ = "" OR in$ = esc$ THEN EXIT DO
  230.         name$ = UCASE$(in$)
  231.         x = 0
  232.         DO UNTIL x = numrecs
  233.             x = x + 1
  234.             IF LEFT$(name$(x), LEN(name$)) = name$ THEN
  235.                 LOCATE 19, 42: PRINT name$(x)
  236.                 found = x
  237.                 EXIT DO
  238.             END IF
  239.         LOOP
  240.         LOCATE 21, 42
  241.         keyin 20
  242.         IF in$ = esc$ THEN EXIT DO
  243.         newname$ = UCASE$(in$)
  244.         IF newname$ <> "" THEN name$(found) = newname$
  245.         LOCATE 22, 42
  246.         keyin 15
  247.         IF in$ = esc$ THEN EXIT DO
  248.         newnumber$ = UCASE$(in$)
  249.         IF newnumber$ <> "" THEN number$(found) = newnumber$
  250.         IF found = 0 THEN prompt "No listing by that name found. Hit a key or button.": inbutton
  251.     LOOP
  252.     sortdatafile
  253.     writedatafile
  254. END SUB
  255.  
  256. SUB findname
  257.     IF LEFT$(name$, 1) = "*" THEN name$ = MID$(name$, 2): add$ = prefix$
  258.     IF VAL(LEFT$(name$, 1)) > 0 THEN
  259.         call$ = name$
  260.         dial$ = add$ + name$
  261.         hyphen
  262.         EXIT SUB
  263.         ELSE
  264.         FOR x = 1 TO numrecs
  265.             IF LEFT$(name$(x), LEN(name$)) = name$ THEN
  266.                 call$ = name$(x)
  267.                 dial$ = add$ + number$(x)
  268.             END IF
  269.         NEXT x
  270.     END IF
  271.     IF call$ = "" THEN prompt "No listing for that name found. Hit a key or button.": inbutton
  272.     hyphen
  273. END SUB
  274.  
  275. SUB getbutton
  276.     DO
  277.         inbutton
  278.         IF in$ = enter$ THEN
  279.             SELECT CASE mrow
  280.                 CASE 2
  281.                     mousecommand
  282.                 CASE 5 TO 24
  283.                     mouseread
  284.                     mousemove 2, 80
  285.                 CASE 25
  286.                     mousepage
  287.             END SELECT
  288.         END IF
  289.     LOOP UNTIL in$ <> ""
  290. END SUB
  291.  
  292. SUB getmouse
  293.     mouse 3, button, x, y
  294.     mrow = INT(y / 8) + 1
  295.     mcol = INT(x / 8) + 1
  296. END SUB
  297.  
  298. SUB getname
  299.     prompt "Enter * for Prefix Code, Name, Number, or [Esc] to EXIT."
  300.     d$(1) = "Enter NAME or UNIQUE PARTIAL NAME or"
  301.     d$(2) = "enter phone number using hyphen"
  302.     d$(3) = "for 2 second pause. * for PREFIX CODE."
  303.     d$(4) = "NAME: " + STRING$(20, 254)
  304.     dialog 10, "PLACE CALL"
  305.     LOCATE 22, 27
  306.     keyin 20
  307.     IF in$ = "" OR in$ = esc$ THEN EXIT SUB
  308.     IF VAL(in$) = 0 THEN
  309.         name$ = UCASE$(in$)
  310.         findname
  311.         ELSE call$ = in$
  312.              dial$ = in$
  313.     END IF
  314.     LOCATE 22, 27: PRINT call$
  315. END SUB
  316.  
  317. SUB getsubletter
  318.     x = 0
  319.     DO
  320.         x = x + 1
  321.         IF in$ = LEFT$(sel$(sel, x), 1) THEN
  322.             subsel = x
  323.             in$ = enter$
  324.                EXIT DO
  325.         END IF
  326.     LOOP UNTIL x = totsubs
  327. END SUB
  328.  
  329. SUB goodbye
  330.     hidemouse
  331.     COLOR 7, 0
  332.     CLOSE
  333.     CLS
  334.     END
  335. END SUB
  336.  
  337. SUB hangup
  338.     dialheader
  339.     IF port = 0 THEN EXIT SUB
  340.     CLOSE port
  341.     OPEN port$ FOR OUTPUT AS port
  342.     FOR x = 1 TO 3
  343.         PRINT #port, "ATH0"
  344.     NEXT x
  345.     LOCATE 2, 1
  346.     COLOR high, back
  347.     PRINT "Modem hung-up."
  348.     COLOR fore, back
  349.     CLOSE port
  350. END SUB
  351.  
  352. SUB header
  353.     LOCATE 1, 1
  354.     COLOR back, fore
  355.     PRINT SPACE$(80);
  356.     LOCATE 1, 1
  357.     COLOR high: PRINT " DIAL";
  358.     COLOR back, fore: PRINT " Phone Dialer v3.2"
  359.     LOCATE 1, 44: PRINT newdate$;
  360.     LOCATE 1, 68: PRINT newtime$(TIME$)
  361.     COLOR fore, back
  362. END SUB
  363.  
  364. SUB helpscreen (page)
  365.     clearall
  366.     IF page = 2 THEN GOTO page2
  367.     pagehead "HELP WITH FULL SCREEN MODE"
  368.     PRINT ""
  369.     PRINT ""
  370.     PRINT "           EXECUTE COMMANDS:"
  371.     PRINT "                Use [LeftArrow] or [RightArrow] and hit [Return]"
  372.     PRINT "                or hit any of the highlighted initial letters"
  373.     PRINT ""
  374.     PRINT "           VIEW DIRECTORY:"
  375.     PRINT "                [PgDn]     View next page"
  376.     PRINT "                [PgUp]     View previous page"
  377.     PRINT "                [Home]     View first page"
  378.     PRINT "                [End]      View last page"
  379.     PRINT ""
  380.     PRINT "           MOUSE CONTROL:  Left Button = [Return]    Right Button = [Esc] "
  381.     PRINT "                Move cursor to command and click. Or move cursor to name"
  382.     PRINT "                or number, then double click left button to dial."
  383.     PRINT "                Click on page buttons on bottom line to page directory."
  384.     PRINT "                Hit [Esc] at any time to cancel commands or EXIT program."
  385.     PRINT "                Turn Mouse on or off inside Settings option on top menu."
  386.     prompt "Hit any key or button to continue."
  387.     inbutton
  388.     EXIT SUB
  389. page2:
  390.     pagehead "DIAL COMMANDS FOR DOS LINE OPERATION"
  391.     PRINT ""
  392.     PRINT ""
  393.     PRINT "           name      Gets name from directory and dials its number."
  394.     PRINT "                     Uses full name or unique first part of name."
  395.     PRINT ""
  396.     PRINT "           number    Dialing a number not in the Directory."
  397.     PRINT ""
  398.     PRINT "           @file     Activates directory file other than default DIAL.DAT."
  399.     PRINT ""
  400.     PRINT "           *number   Dial prefix before number."
  401.     PRINT ""
  402.     PRINT "           *name     Dial prefix before number that goes with name."
  403.     PRINT ""
  404.     PRINT "           When assigning phone numbers, insert hyphen for two second pause."
  405.     PRINT ""
  406.     PRINT "           NOTE: This program assumes use of the Hayes command set.";
  407.     prompt "Hit any key or button to continue."
  408.     inbutton
  409. END SUB
  410.  
  411. SUB hidemouse
  412.     mouse 2, 0, 0, 0
  413. END SUB
  414.  
  415. SUB hyphen
  416.     IF LEFT$(dial$, 1) = "*" THEN dial$ = prefix$ + MID$(dial$, 2)
  417.     FOR d = 1 TO LEN(dial$)
  418.         IF MID$(dial$, d, 1) = "-" THEN
  419.             MID$(dial$, d, 1) = ","
  420.         END IF
  421.     NEXT d
  422. END SUB
  423.  
  424. SUB inbutton
  425.     DO
  426.         clock
  427.         checkinput
  428.     LOOP UNTIL in$ <> ""
  429. END SUB
  430.  
  431. SUB initialize
  432.     CLS
  433.     IF dosvers >= 3 THEN
  434.         IF mouseinstalled = 0 THEN mouseon = 0 ELSE mouseon = 1
  435.         ELSE mouseon = 0
  436.     END IF
  437.     LOCATE , , 0, 6, 7           'turns cursor off
  438.     version = 3.2
  439.     port$ = "COM1:"
  440.     tone$ = "TONE"
  441.     initial$ = "Q0 V1 X4 S0=0"
  442.     prefix$ = ""
  443.     path$ = ""
  444.     fore = 7
  445.     back = 0
  446.     high = 15
  447.     freq = 750
  448.     items = 7
  449.     menuarrays
  450.     setnames
  451.     datafile$ = "DIAL.DAT"
  452.     tempfile$ = "dial.tmp"
  453.     header
  454.     checkdatafile
  455.     mouseis mouseon
  456.     logfile$ = path$ + "dial.log"
  457. END SUB
  458.  
  459. '---------------------- INPUT ANSWER FROM KEYBOARD ----------------------------
  460. SUB keyin (length)
  461.      word$ = ""
  462.      inrow = CSRLIN: incol = POS(0): ch$ = CHR$(SCREEN(inrow, incol))
  463.      COLOR back + 16, fore: PRINT ch$; CHR$(29);
  464.      DO
  465.       dummy = 0
  466.       IF LEN(word$) = 1 AND length = 1 THEN in$ = enter$ ELSE inbutton
  467.       SELECT CASE in$
  468.         CASE enter$
  469.             COLOR back, fore
  470.             IF LEN(word$) < length THEN PRINT ch$;
  471.             in$ = word$
  472.             EXIT DO
  473.         CASE esc$
  474.             in$ = esc$
  475.             EXIT DO
  476.         CASE bksp$                                        'bksp and blank out answer
  477.             IF word$ <> "" THEN
  478.                 COLOR back, fore
  479.                 IF LEN(word$) <> length THEN PRINT CHR$(254);  ELSE PRINT CHR$(0);
  480.                 COLOR back + 16, fore
  481.                 PRINT CHR$(29); CHR$(29); CHR$(254); CHR$(29);
  482.                 word$ = LEFT$(word$, LEN(word$) - 1)
  483.             END IF
  484.         CASE ELSE
  485.             IF LEN(word$) = length THEN
  486.                 click
  487.                 ELSE
  488.                     LOCATE inrow, incol
  489.                     word$ = word$ + in$
  490.                     PRINT word$;
  491.                     IF LEN(word$) <> length THEN
  492.                         COLOR back + 16, fore
  493.                         PRINT CHR$(254); CHR$(29);
  494.                     END IF
  495.             END IF
  496.       END SELECT
  497.     LOOP
  498. END SUB
  499.  
  500. SUB logcall
  501.     IF call$ = "" THEN EXIT SUB
  502.     LOCATE 3, 1
  503.     COLOR high, back
  504.     PRINT "When phone is answered, hit L to LOG call, or any key or button to EXIT."
  505.     COLOR fore, back
  506.     inbutton
  507.     IF in$ <> "L" THEN EXIT SUB
  508.     openlogfile
  509.     ontime$ = newtime$(TIME$)
  510.         onhour = VAL(hour$)
  511.         onmin = VAL(min$)
  512.         onsec = VAL(sec$)
  513.     d$(2) = "At end of call, hit any key or button to log time."
  514.     d$(3) = "            Elapsed Time: 00:00"
  515.     dialog 5, "LOG CALL"
  516.     start = TIMER
  517.     timeout
  518.     prompt "Call to " + call$ + " logged in DIAL.LOG."
  519.     PRINT #logfile, newdate$, LEFT$(call$, 12), dial$, ontime$, offtime$, tottime$
  520.     CLOSE logfile
  521. END SUB
  522.  
  523. SUB mainscreen
  524.       header
  525.       viewdir
  526. END SUB
  527.  
  528. SUB makenewdir
  529.     pagehead "DIRECTORY"
  530.     d$(1) = "This utility makes a new phone directory. Enter"
  531.     d$(2) = "a name for the new directory. If an existing"
  532.     d$(3) = "filename is specified, that file will be DELETED."
  533.     d$(4) = "Use DIAL.DAT only to make a new default directory."
  534.     dialog 5, "MAKE NEW DIRECTORY"
  535.     prompt "Enter filename: " + STRING$(12, 254)
  536.     COLOR back, fore
  537.     LOCATE 25, 42
  538.     keyin 12
  539.     IF in$ = "" OR in$ = esc$ THEN datafile$ = "DIAL.DAT": EXIT SUB
  540.     restart
  541.     datafile$ = in$
  542.     IF datafile$ = "DIAL.DAT" THEN
  543.         LOCATE 7, 1
  544.         COLOR fore, back
  545.         PRINT "============================================================================"
  546.         COLOR high
  547.         PRINT "WARNING: ";
  548.         COLOR fore
  549.         PRINT "If you proceed with this, existing DIAL.DAT file will be replaced."
  550.         PRINT "                  Hit [Esc] to EXIT or any key to continue."
  551.         PRINT "============================================================================"
  552.         prompt "Continuing will replace existing default Directory. Hit [Esc] to EXIT."
  553.         inbutton
  554.         IF in$ = esc$ THEN goodbye
  555.         ELSE datafile$ = path$ + datafile$
  556.     END IF
  557.     numrecs = 0
  558.     addnames
  559. END SUB
  560.  
  561. SUB menuarrays
  562.  
  563. '======= Define Top Slide Bar Menu
  564. sel$(1, 0) = "Place call"
  565. sel$(2, 0) = "Directory"
  566. sel$(3, 0) = "Change dir"
  567. sel$(4, 0) = "Modem hang up"
  568. sel$(5, 0) = "Settings"
  569. sel$(6, 0) = "Help"
  570. sel$(7, 0) = "Exit"
  571. '===== Define Help messages for line 3
  572.  
  573. sel$(1, 10) = "Place and log call, Demon dial call                                             "
  574. sel$(2, 10) = "Add, edit and delete names and numbers                                          "
  575. sel$(3, 10) = "Change directory file, make a new directory file                                "
  576. sel$(4, 10) = "Hang up modem line                                                              "
  577. sel$(5, 10) = "Set colors, beep, mouse, port, dial type, default path and prefix code          "
  578. sel$(6, 10) = "Help with DOS commands and with this screen                                     "
  579. sel$(7, 10) = "Exit from this program                                                          "
  580.  
  581. '===== Define Sub Selections For Menu Items   NOTE: each submenu item is same length
  582.                 
  583. sel$(1, 1) = "Place call"
  584. sel$(1, 2) = "Demon dial"
  585.  
  586. sel$(2, 1) = "Add names + #s"
  587. sel$(2, 2) = "Edit name + #s"
  588. sel$(2, 3) = "Delete name   "
  589.  
  590. sel$(3, 1) = "Change dir  "
  591. sel$(3, 2) = "Make new dir"
  592.         
  593. sel$(4, 1) = "Hang up modem now"
  594.  
  595. sel$(5, 1) = "Port "
  596. sel$(5, 2) = "Color"
  597. sel$(5, 3) = "Sound"
  598. sel$(5, 4) = "Mouse"
  599. sel$(5, 5) = "DPath"
  600.  
  601. sel$(6, 1) = "Full Screen"
  602. sel$(6, 2) = "DOS Command"
  603.  
  604. sel$(7, 1) = "EXIT NOW"
  605.  
  606. END SUB
  607.  
  608. SUB menufindcol
  609.     col = 1
  610.     FOR x = 1 TO sel - 1
  611.         col = col + LEN(sel$(x, 0)) + 2
  612.     NEXT x
  613. END SUB
  614.  
  615. SUB menuhighlight
  616.     COLOR high, fore
  617.     LOCATE lin, col
  618.     PRINT SPACE$(1); LEFT$(sel$(sel, subsel), 1);
  619.     COLOR back, fore
  620.     PRINT MID$(sel$(sel, subsel), 2); SPACE$(1);
  621.     COLOR fore, back
  622.     LOCATE 3, 1: PRINT sel$(sel, 10)
  623. END SUB
  624.  
  625. SUB menuinput
  626.     menutopline
  627.     menutoploop                           'gets first menu command
  628.     IF sel = 0 THEN EXIT SUB              'if escape is passed then exit
  629.     hidemouse
  630. DO
  631.     menufindcol
  632.     subwindow
  633.     mousewindow 74, 80, 4, totsubs + 3
  634.     DO                                    'gets second menu command
  635.         lin = subsel + 3
  636.         mousemove lin, 77
  637.         subhighlight
  638.         subbutton
  639.         menufindcol
  640.         menuhighlight
  641.         getsubletter
  642.         SELECT CASE in$               'analyzes keystrokes
  643.             CASE esc$
  644.                 showmouse
  645.                 EXIT SUB
  646.             CASE enter$
  647.                 showmouse
  648.                 sel = (sel * 10) + subsel
  649.                 EXIT SUB
  650.             CASE lft$
  651.                 subsel = 1
  652.                 sel = sel - 1
  653.                 IF sel < 1 THEN sel = items
  654.                 menufindcol
  655.                 EXIT DO
  656.             CASE rght$
  657.                 subsel = 1
  658.                 sel = sel + 1
  659.                 IF sel > items THEN sel = 1
  660.                 menufindcol
  661.                 EXIT DO
  662.             CASE up$
  663.                 subsel = subsel - 1
  664.                 IF subsel < 1 THEN subsel = 1
  665.             CASE down$
  666.                 subsel = subsel + 1
  667.                 IF subsel > totsubs THEN subsel = totsubs
  668.             CASE end$
  669.                 subsel = totsubs
  670.             CASE home$
  671.                 subsel = 1
  672.         END SELECT
  673.     LOOP
  674.     viewdir                                'refreshes screen, erase window
  675. LOOP
  676. END SUB
  677.  
  678. SUB menuletter
  679.     FOR x = 1 TO items
  680.         IF in$ = LEFT$(sel$(x, 0), 1) THEN
  681.             sel = x
  682.             in$ = enter$
  683.         END IF
  684.     NEXT x
  685.     menufindcol
  686. END SUB
  687.  
  688. SUB menuroutine
  689.     DO
  690.         mainscreen
  691.         menuinput
  692.         mousewindow 1, 80, 2, 25
  693.         IF sel <> 0 AND sel <> 61 THEN viewdir
  694.         SELECT CASE sel
  695.             CASE 0:  EXIT DO 'escape key
  696.             CASE 11: placecall
  697.             CASE 12: demondial
  698.             CASE 21: addnames
  699.             CASE 22: editname
  700.             CASE 23: deletename
  701.             CASE 31: changedir
  702.             CASE 32: makenewdir
  703.             CASE 41: hangup
  704.             CASE 51: setport
  705.             CASE 52: setcolor
  706.             CASE 53: setsound
  707.             CASE 54: setmouse
  708.             CASE 55: setdpath
  709.             CASE 61: helpscreen 1
  710.             CASE 62: helpscreen 2
  711.             CASE 71: EXIT DO
  712.             CASE ELSE: click
  713.         END SELECT
  714.     LOOP
  715. END SUB
  716.  
  717. SUB menutopline
  718.     col = 1
  719.     sel = 1
  720.     subsel = 0
  721.     lin = 2
  722.     FOR x = 1 TO items                    'prints top menu line
  723.         sel = x
  724.         menuunhighlight
  725.         col = col + LEN(sel$(sel, 0)) + 2
  726.     NEXT
  727.     col = 1
  728.     sel = 1
  729.     menuhighlight                         'highlights first menu item
  730.     showmouse
  731. END SUB
  732.  
  733. SUB menutoploop
  734.     DO
  735.         getbutton
  736.         menufindcol
  737.         menuunhighlight
  738.         menuletter
  739.         SELECT CASE in$
  740.             CASE esc$
  741.                 sel = 0
  742.                 EXIT DO
  743.             CASE enter$, down$
  744.                 EXIT DO
  745.             CASE rght$
  746.                 col = col + LEN(sel$(sel, 0)) + 2
  747.                 sel = sel + 1
  748.                 IF sel > items THEN sel = 1: col = 1
  749.             CASE lft$
  750.                 col = col - LEN(sel$(sel - 1, 0)) - 2
  751.                 sel = sel - 1
  752.                 IF sel < 1 THEN sel = items: menufindcol
  753.             CASE pgup$
  754.                 IF dirpage = 0 THEN
  755.                     click
  756.                     ELSE dirpage = dirpage - 40
  757.                          IF dirpage < 0 THEN dirpage = 0
  758.                          viewdir
  759.                 END IF
  760.             CASE pgdn$
  761.                 IF dirpage = 440 OR dirpage >= numrecs - 40 THEN
  762.                     click
  763.                     ELSE dirpage = dirpage + 40
  764.                         viewdir
  765.                 END IF
  766.             CASE home$
  767.                 IF dirpage > 0 THEN
  768.                     dirpage = 0
  769.                     viewdir
  770.                     ELSE click
  771.                 END IF
  772.             CASE end$
  773.                 IF dirpage = 440 OR dirpage >= numrecs - 40 THEN
  774.                     click
  775.                     ELSE dirpage = numrecs - 40
  776.                          viewdir
  777.                 END IF
  778.             CASE ELSE
  779.                 click
  780.         END SELECT
  781.         menuhighlight
  782.     LOOP
  783. END SUB
  784.  
  785. SUB menuunhighlight
  786.     LOCATE lin, col
  787.     COLOR high, back
  788.     PRINT SPACE$(1); LEFT$(sel$(sel, subsel), 1);
  789.     COLOR fore, back
  790.     PRINT MID$(sel$(sel, subsel), 2); SPACE$(1);
  791. END SUB
  792.  
  793. SUB mouse (m1, m2, m3, m4)
  794.     IF mouseon = 0 THEN EXIT SUB
  795.     inregs.ax = m1
  796.     inregs.bx = m2
  797.     inregs.cx = m3
  798.     inregs.dx = m4
  799.     CALL interrupt(51, inregs, outregs)
  800.     m1 = outregs.ax
  801.     m2 = outregs.bx
  802.     m3 = outregs.cx
  803.     m4 = outregs.dx
  804. END SUB
  805.  
  806. SUB mousecommand
  807.     SELECT CASE mcol
  808.         CASE 1 TO 12: in$ = "P"
  809.         CASE 13 TO 23: in$ = "D"
  810.         CASE 24 TO 35: in$ = "C"
  811.         CASE 36 TO 50: in$ = "M"
  812.         CASE 51 TO 60: in$ = "S"
  813.         CASE 61 TO 67: in$ = "H"
  814.         CASE 68 TO 73: in$ = "E"
  815.         CASE ELSE: click
  816.     END SELECT
  817. END SUB
  818.  
  819. FUNCTION mouseinstalled
  820.     m = 0                      ' reset function
  821.     mouse m, n, 0, 0           ' returns M = 0 if no mouse installed
  822.     mouseinstalled = m
  823. END FUNCTION
  824.  
  825. SUB mouseis (mouseon)
  826.     IF mouseon = 0 THEN m = 2 ELSE m = 1
  827.     mouse m, 1, 0, 0
  828.     mousewindow 1, 80, 2, 25
  829.     mousemove 2, 80
  830. END SUB
  831.  
  832. FUNCTION mousemotion
  833.     IF mouseon = 0 THEN EXIT FUNCTION
  834.     getmouse
  835.     SELECT CASE mrow
  836.         CASE IS > lin: m = 1
  837.         CASE IS < lin: m = -1
  838.         CASE ELSE: m = 0
  839.     END SELECT
  840.     SELECT CASE mcol
  841.         CASE IS < 75: m = -2
  842.         CASE IS > 79: m = 2
  843.     END SELECT
  844.     mousemotion = m
  845. END FUNCTION
  846.  
  847. SUB mousemove (mrow, mcol)
  848.     y = (mrow - 1) * 8: x = (mcol - 1) * 8
  849.     mouse 4, button, x, y
  850. END SUB
  851.  
  852. SUB mousepage
  853.     SELECT CASE mcol
  854.         CASE 2 TO 12
  855.             in$ = "H"
  856.         CASE 23 TO 28
  857.             in$ = home$
  858.         CASE 31 TO 35
  859.             in$ = end$
  860.         CASE 38 TO 43
  861.             in$ = pgup$
  862.         CASE 45 TO 51
  863.             in$ = pgdn$
  864.         CASE 67 TO 76
  865.             in$ = esc$
  866.         CASE ELSE
  867.             click
  868.     END SELECT
  869. END SUB
  870.  
  871. SUB mouseread
  872.     IF mcol > 40 THEN mcol = 41 ELSE mcol = 1
  873.     entry$ = ""
  874.     FOR x = mcol TO mcol + 36
  875.         entry$ = entry$ + CHR$(SCREEN(mrow, x))
  876.     NEXT x
  877.     LOCATE mrow, mcol
  878.     COLOR back, fore
  879.     PRINT entry$;
  880.     call$ = LTRIM$(RTRIM$(LEFT$(entry$, 20)))
  881.     dial$ = LTRIM$(RTRIM$(MID$(entry$, 22, 15)))
  882.     hyphen
  883.     in$ = "P"
  884. END SUB
  885.  
  886. SUB mousewindow (left, right, top, bottom)
  887.     l = (left - 1) * 8: IF l < 0 THEN l = 0
  888.     r = (right - 1) * 8: IF r > 632 THEN r = 632
  889.     t = (top - 1) * 8: IF t < 0 THEN t = 0
  890.     b = (bottom - 1) * 8: IF b > 192 THEN b = 192
  891.     mouse 7, 0, l, r
  892.     mouse 8, 0, t, b
  893. END SUB
  894.  
  895. FUNCTION newdate$
  896.     day$(0) = "Sunday"
  897.     day$(1) = "Monday"
  898.     day$(2) = "Tuesday"
  899.     day$(3) = "Wednesday"
  900.     day$(4) = "Thursday"
  901.     day$(5) = "Friday"
  902.     day$(6) = "Saturday"
  903.     month$(1) = "Jan"
  904.     month$(2) = "Feb"
  905.     month$(3) = "Mar"
  906.     month$(4) = "Apr"
  907.     month$(5) = "May"
  908.     month$(6) = "Jun"
  909.     month$(7) = "Jul"
  910.     month$(8) = "Aug"
  911.     month$(9) = "Sep"
  912.     month$(10) = "Oct"
  913.     month$(11) = "Nov"
  914.     month$(12) = "Dec"
  915.     t1 = &H2A00: t2 = 0: t3 = 0: t4 = 0
  916.     inregs.ax = t1: inregs.bx = t2: inregs.cx = t3: inregs.dx = t4
  917.     CALL interrupt(&H21, inregs, outregs)
  918.     t1 = outregs.ax: t2 = outregs.bx: t3 = outregs.cx: t4 = outregs.dx
  919.     day = t1 - ((FIX(t1 / 256)) * 256)
  920.     day$ = day$(day)
  921.     year = t3
  922.     year$ = LTRIM$(RTRIM$(STR$(year)))
  923.     month = FIX(t4 / 256)
  924.     month$ = month$(month)
  925.     date = t4 - (month * 256)
  926.     newdate$ = day$ + SPACE$(2) + month$ + STR$(date) + "," + STR$(year)
  927. END FUNCTION
  928.  
  929. FUNCTION newtime$ (oldtime$)
  930.      hour$ = LEFT$(oldtime$, 2)
  931.      min$ = MID$(oldtime$, 4, 2)
  932.      sec$ = RIGHT$(oldtime$, 2)
  933.      hour = VAL(hour$)
  934.           IF hour < 12 THEN ampm$ = "am" ELSE ampm$ = "pm"
  935.           IF hour > 12 THEN hour = hour - 12
  936.      hour$ = STR$(hour)
  937.      newtime$ = hour$ + ":" + min$ + ":" + sec$ + " " + ampm$
  938. END FUNCTION
  939.  
  940. SUB opendatafile
  941.     datafile = FREEFILE
  942.     OPEN datafile$ FOR INPUT AS datafile
  943. END SUB
  944.  
  945. SUB openlogfile
  946.     logfile = FREEFILE
  947.     OPEN logfile$ FOR APPEND AS logfile
  948. END SUB
  949.  
  950. SUB openport
  951.     port = FREEFILE
  952.     OPEN port$ FOR RANDOM AS port
  953. END SUB
  954.  
  955. SUB pagehead (page$)
  956.     LOCATE 4, 1
  957.     COLOR back, fore
  958.     PRINT STRING$(80, 32);
  959.     LOCATE 4, 41 - (LEN(page$) / 2)
  960.     COLOR high, fore
  961.     PRINT page$;
  962.     COLOR fore, back
  963. END SUB
  964.  
  965. SUB placecall
  966.     pagehead "PLACE CALL"
  967.     IF call$ = "" THEN viewdir: getname
  968.     IF call$ = "" THEN EXIT SUB
  969.     mainscreen
  970.     dialheader
  971.     LOCATE 2, 1
  972.     COLOR high, back
  973.     IF demon = 1 THEN
  974.         PRINT "DEMON-DIALING your call to "; call$; ", "; dial$; ".  TRY"; try
  975.         PRINT "Hit any key or button to exit DEMON DIAL when connected."
  976.     END IF
  977.     IF demon = 0 THEN
  978.         IF call$ = dial$ THEN
  979.             PRINT "Your call to "; call$; " is dialing."
  980.             ELSE PRINT "Your call to "; call$; ", "; dial$; " is dialing."
  981.         END IF
  982.         PRINT "Wait for RING signal, then hit any key or button to HANG UP modem."
  983.     END IF
  984.     checkinput
  985.     IF in$ <> "" THEN EXIT SUB
  986.     openport
  987.     t$ = LEFT$(tone$, 1)
  988.     PRINT #port, "AT " + initial$ + " D" + t$ + dial$
  989.     DO
  990.         clock
  991.         checkinput
  992.         IF in$ <> "" THEN hangup: call$ = "": EXIT SUB
  993.         income = LOC(port)
  994.         IF income <> 0 THEN modem$ = INPUT$(1, #port)
  995.         SELECT CASE modem$
  996.             CASE "B"
  997.                 hangup
  998.                 IF demon = 1 THEN EXIT SUB
  999.                 d$(1) = "Hit [SpaceBar] or Left Button to redial once,"
  1000.                 d$(2) = " or [D] to demon-dial call until it connects,"
  1001.                 d$(3) = " or any other key or Right Button to exit."
  1002.                 dialog 5, "BUSY SIGNAL"
  1003.                 prompt ""
  1004.                 inbutton
  1005.                 SELECT CASE in$
  1006.                     CASE CHR$(32), enter$
  1007.                         placecall
  1008.                     CASE "D"
  1009.                         demondial
  1010.                         EXIT DO
  1011.                     CASE ELSE
  1012.                         EXIT SUB
  1013.                 END SELECT
  1014.             CASE "E"
  1015.                 dialheader
  1016.                 LOCATE 2, 1
  1017.                 PRINT "ERROR: Something wrong trying to dial out. Hit a key or button."
  1018.                 inbutton
  1019.                 EXIT SUB
  1020.             CASE "R"
  1021.                 EXIT DO
  1022.             CASE ELSE
  1023.                 dummy = 0
  1024.         END SELECT
  1025.     LOOP
  1026.     ring
  1027.     hangup
  1028.     logcall
  1029.     add$ = ""
  1030.     call$ = ""
  1031. END SUB
  1032.  
  1033. SUB prompt (msg$)
  1034.     LOCATE 25, 1
  1035.     COLOR back, high
  1036.     PRINT SPACE$(80);
  1037.     t = INT((80 - LEN(msg$)) / 2)
  1038.     LOCATE 25, t: PRINT msg$;
  1039.     COLOR fore, back
  1040. END SUB
  1041.  
  1042. SUB qsort (srtn(), mid)
  1043.      DIM newname$(numrecs), newnumber$(numrecs), newsrtn(numrecs)
  1044.      y = 0: z = 0
  1045. FOR x = 1 TO numrecs
  1046.      IF srtn(x) > mid THEN
  1047.       newsrtn(numrecs - y) = srtn(x)
  1048.       newname$(numrecs - y) = name$(x)
  1049.       newnumber$(numrecs - y) = number$(x)
  1050.       y = y + 1
  1051.       ELSE newsrtn(z + 1) = srtn(x)
  1052.            newname$(z + 1) = name$(x)
  1053.            newnumber$(z + 1) = number$(x)
  1054.            z = z + 1
  1055.      END IF
  1056. NEXT x
  1057. FOR t = 1 TO numrecs
  1058.     name$(t) = newname$(t)
  1059.     number$(t) = newnumber$(t)
  1060.     srtn(t) = newsrtn(t)
  1061. NEXT t
  1062. ERASE newname$, newnumber$, newsrtn
  1063.      num$ = SPACE$(4)
  1064.      LSET num$ = STR$(numrecs)
  1065.      prompt "Total Names:" + num$ + SPACE$(10) + "Sorting #:"
  1066.      COLOR back, fore
  1067.      FOR x = 1 TO y
  1068.            FOR w = 1 TO z - x
  1069.             IF srtn(x) > srtn(x + w) THEN
  1070.                 SWAP srtn(x), srtn(x + w)
  1071.                 SWAP name$(x), name$(x + w)
  1072.                 SWAP number$(x), number$(x + w)
  1073.             END IF
  1074.            NEXT w
  1075.      LOCATE 25, 58: PRINT x;
  1076.      NEXT x
  1077.      FOR x = y - 1 TO numrecs
  1078.            FOR y = 1 TO numrecs - x
  1079.             IF srtn(x) > srtn(x + y) THEN
  1080.                 SWAP srtn(x + y), srtn(x)
  1081.                 SWAP name$(x + y), name$(x)
  1082.                 SWAP number$(x + y), number$(x)
  1083.             END IF
  1084.            NEXT y
  1085.      LOCATE 25, 58: PRINT x;
  1086.      NEXT x
  1087.      COLOR fore, back
  1088. END SUB
  1089.  
  1090. SUB readcommandline
  1091.     inline$ = UCASE$(COMMAND$)
  1092.     IF inline$ = "MAKE" THEN
  1093.         makenewdir
  1094.         inline$ = ""
  1095.     END IF
  1096.     IF inline$ = "" THEN EXIT SUB
  1097. rerun:
  1098.     mark$ = LEFT$(inline$, 1)
  1099.     SELECT CASE mark$
  1100.         CASE "@"
  1101.             phonelist$ = MID$(inline$, 2)
  1102.             restart
  1103.             changedir
  1104.             EXIT SUB
  1105.         CASE "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
  1106.             call$ = add$ + inline$
  1107.             dial$ = add$ + inline$
  1108.         CASE ELSE
  1109.             name$ = inline$
  1110.             findname
  1111.     END SELECT
  1112.     hyphen
  1113.     placecall
  1114.     goodbye
  1115. END SUB
  1116.  
  1117. SUB readdatafile
  1118.     opendatafile
  1119.     numrecs = 0
  1120.     INPUT #datafile, version, port$, tone$, initial$, prefix$, path$, fore, back, high, freq, mouseon
  1121.     WHILE NOT EOF(datafile)
  1122.         numrecs = numrecs + 1
  1123.         INPUT #datafile, name$(numrecs), number$(numrecs)
  1124.     WEND
  1125.     CLOSE datafile
  1126. END SUB
  1127.  
  1128. SUB restart
  1129.     FOR x = 1 TO numrecs
  1130.         name$(x) = ""
  1131.         number$(x) = ""
  1132.     NEXT x
  1133. END SUB
  1134.  
  1135. SUB ring
  1136.     DO
  1137.         LOCATE 3, 1
  1138.         COLOR high, back
  1139.         PRINT "Pick up the receiver, THEN hit any key or button to hang up modem."
  1140.         FOR x = 1 TO 5
  1141.             SOUND 850, .85
  1142.             SOUND 650, .85
  1143.         NEXT x
  1144.         checkinput
  1145.         IF in$ <> "" THEN EXIT DO
  1146.         time1 = TIMER
  1147.         DO
  1148.             time2 = TIMER
  1149.             LOCATE 3, 1
  1150.             COLOR fore, back
  1151.             PRINT "Pick up the receiver, THEN hit any key or button to hang up modem."
  1152.             checkinput
  1153.             IF in$ <> "" THEN EXIT SUB
  1154.         LOOP UNTIL time2 = time1 + 4
  1155.     LOOP
  1156.     COLOR fore, back
  1157. END SUB
  1158.  
  1159. SUB setcolor
  1160.     prompt "Hit [Return] to reset entry to original setting."
  1161.     d$(1) = "   Enter number for each color selection."
  1162.     d$(3) = " 0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15"
  1163.     d$(4) = "   FOREGROUND: " + STRING$(2, 254) + "   BACKGROUND: " + STRING$(2, 254) + "   HIGHLIGHT: " + STRING$(2, 254)
  1164.     dialog 2, "SET COLORS"
  1165.     LOCATE 20, 13
  1166.     FOR x = 0 TO 9
  1167.         COLOR x, 0: PRINT STRING$(3, 254);
  1168.     NEXT x
  1169.     FOR x = 10 TO 15
  1170.         COLOR x, 0: PRINT STRING$(4, 254);
  1171.     NEXT x
  1172.     COLOR back, fore
  1173.     LOCATE 22, 28
  1174.     keyin 2
  1175.     fore = VAL(in$)
  1176.     IF fore = 0 THEN fore = 7
  1177.     LOCATE 22, 45
  1178.     keyin 2
  1179.     back = VAL(in$)
  1180.     IF back = fore THEN back = 0
  1181.     LOCATE 22, 61
  1182.     keyin 2
  1183.     high = VAL(in$)
  1184.     IF high = back THEN high = 15
  1185.     writedatafile
  1186.     mainscreen
  1187. END SUB
  1188.  
  1189. SUB setdpath
  1190.     pagehead "SETTINGS"
  1191.     d$(1) = "This setting option permits you to specify"
  1192.     d$(2) = "the drive or suddirectory (path) for all files"
  1193.     d$(3) = "that the program makes except DIAL DAT. Use the"
  1194.     d$(4) = "full, exact pathname. Ex:  A:  or  C:\utilities  "
  1195.     dialog 5, "SET DEFAULT PATH"
  1196.     prompt "Enter full path: " + STRING$(18, 254)
  1197.     COLOR back, fore
  1198.     LOCATE 25, 39
  1199.     keyin 18
  1200.     IF in$ = "" OR in$ = esc$ THEN EXIT SUB
  1201.     path$ = in$
  1202.     IF LEN(in$) = 1 THEN
  1203.         path$ = path$ + ":"
  1204.         ELSEIF RIGHT$(path$, 1) <> ":" AND RIGHT$(path$, 1) <> "\" THEN
  1205.                path$ = path$ + "\"
  1206.     END IF
  1207.     writedatafile
  1208. END SUB
  1209.  
  1210. SUB setmouse
  1211.     d$(1) = "Mouse driver must be loaded and active before program"
  1212.     d$(2) = "is loaded. Do not turn mouse on otherwise. In DOS 2.x"
  1213.     d$(3) = "the program will hang if no mouse is present."
  1214.     d$(4) = "Hit [Return] to turn Mouse on, [Esc] to turn Mouse off."
  1215.     dialog 2, "SET MOUSE"
  1216.     prompt "Hit [Return] to turn Mouse ON, [Esc] to turn Mouse OFF."
  1217. askm:
  1218.     inbutton
  1219.     SELECT CASE in$
  1220.         CASE enter$
  1221.             mouseis 1
  1222.             mouseon = 1
  1223.         CASE esc$
  1224.             mouseis 0
  1225.             mouseon = 0
  1226.         CASE ELSE
  1227.             GOTO askm
  1228.     END SELECT
  1229.     writedatafile
  1230. END SUB
  1231.  
  1232. SUB setnames
  1233.       dev$ = CHR$(32) + CHR$(179) + CHR$(32)
  1234.       esc$ = CHR$(27)
  1235.       bksp$ = CHR$(8)
  1236.       enter$ = CHR$(13)
  1237.       up$ = CHR$(0) + CHR$(72)
  1238.       pgup$ = CHR$(0) + CHR$(73)
  1239.       pgdn$ = CHR$(0) + CHR$(81)
  1240.       home$ = CHR$(0) + CHR$(71)
  1241.       end$ = CHR$(0) + CHR$(79)
  1242.       lft$ = CHR$(0) + CHR$(75)
  1243.       rght$ = CHR$(0) + CHR$(77)
  1244.       down$ = CHR$(0) + CHR$(80)
  1245.       quote$ = CHR$(34)
  1246.       comma$ = CHR$(44)
  1247. END SUB
  1248.  
  1249. SUB setport
  1250.     pagehead "LINE SETTINGS"
  1251.     d$(1) = "PORT NUMBER ( if in doubt, type 1 )  : " + port$
  1252.     d$(2) = "DIALTONE TYPE ( T = Tone, P = Pulse ): " + tone$
  1253.     d$(3) = "MODEM INITIALIZATION CODES (see docs): " + STRING$(14, 254)
  1254.     d$(4) = "PREFIX CODE ( dials before a number) : " + STRING$(14, 254)
  1255.     dialog 5, "SETTINGS"
  1256.     prompt "Hit [Return] to keep settings the same."
  1257.     COLOR back, fore
  1258.     LOCATE 21, 55: PRINT initial$
  1259.     LOCATE 22, 55: PRINT prefix$
  1260.     LOCATE 19, 58
  1261.     keyin 1
  1262.     IF in$ = esc$ THEN EXIT SUB
  1263.     IF in$ = "" THEN in$ = MID$(port$, 4, 1)
  1264.     IF VAL(in$) < 0 OR VAL(in$) > 6 THEN goodbye
  1265.     port$ = "COM" + in$ + ":"
  1266. asktype:
  1267.     LOCATE 20, 55
  1268.     keyin 1
  1269.     SELECT CASE in$
  1270.         CASE "T"
  1271.             tone$ = "TONE"
  1272.         CASE "P"
  1273.             tone$ = "PULSE"
  1274.         CASE ""
  1275.             tone$ = tone$
  1276.         CASE esc$
  1277.             EXIT SUB
  1278.         CASE ELSE
  1279.             GOTO asktype
  1280.     END SELECT
  1281.     LOCATE 20, 55
  1282.     PRINT tone$ + SPACE$(1)
  1283.     LOCATE 21, 55
  1284.     keyin 14
  1285.     SELECT CASE in$
  1286.         CASE "": initial$ = initial$
  1287.         CASE esc$: EXIT SUB
  1288.         CASE ELSE: initial$ = in$
  1289.     END SELECT
  1290.     LOCATE 22, 55
  1291.     keyin 14
  1292.     SELECT CASE in$
  1293.         CASE "": prefix$ = prefix$
  1294.         CASE esc$: EXIT SUB
  1295.         CASE ELSE: prefix$ = in$
  1296.     END SELECT
  1297.     writedatafile
  1298. END SUB
  1299.  
  1300. SUB setsound
  1301.     prompt "Enter NUMBER for desired sound frequency of beep."
  1302.     d$(1) = "Select a sound frequency for the beep."
  1303.     d$(2) = "HIGH         MEDIUM          LOW         OFF"
  1304.     d$(3) = " 1              2             3           4"
  1305.     d$(4) = "NEW FREQUENCY: " + CHR$(254)
  1306.     dialog 5, "SET SOUND"
  1307.     LOCATE 22, 31
  1308.     COLOR back, fore
  1309. getfreq:
  1310.     inbutton
  1311.     SELECT CASE VAL(in$)
  1312.         CASE 1
  1313.             freq = 3000
  1314.         CASE 2
  1315.             freq = 750
  1316.         CASE 3
  1317.             freq = 150
  1318.         CASE 4
  1319.             freq = 0
  1320.         CASE ELSE
  1321.             GOTO getfreq
  1322.     END SELECT
  1323.     PRINT in$
  1324.     click
  1325.     writedatafile
  1326.     COLOR , fore, back
  1327. END SUB
  1328.  
  1329. SUB showlist
  1330.     REDIM name$(481), number$(481)
  1331.     readdatafile
  1332.     clearall
  1333.     viewdir
  1334. END SUB
  1335.  
  1336. SUB showmouse
  1337.     mouse 1, 0, 0, 0
  1338. END SUB
  1339.  
  1340. SUB sortdatafile
  1341.      prompt "Preparing to sort Directory."
  1342.      x = 1
  1343.      FOR x = 1 TO numrecs
  1344.       srtn(x) = 0
  1345.       FOR z = 1 TO 5
  1346.            letter$ = MID$(name$(x), z, 1)
  1347.            IF letter$ = "" OR letter$ < CHR$(65) OR letter$ > CHR$(90) THEN
  1348.             srtn(x) = srtn(x) * 100
  1349.             ELSE srtn(x) = (srtn(x) * 100) + (ASC(letter$) - 64)
  1350.            END IF
  1351.       NEXT z
  1352.      stotal = stotal + srtn(x)
  1353.      NEXT x
  1354.      IF numrecs = 0 THEN EXIT SUB
  1355.      mid = stotal / numrecs
  1356.      qsort srtn(), mid
  1357. END SUB
  1358.  
  1359. SUB subbutton
  1360.     DO
  1361.         SELECT CASE mousemotion
  1362.             CASE 1: in$ = down$
  1363.             CASE -1: in$ = up$
  1364.             CASE 2: in$ = rght$
  1365.             CASE -2: in$ = lft$
  1366.             CASE ELSE: checkinput
  1367.         END SELECT
  1368.     LOOP UNTIL in$ <> ""
  1369.     IF sel = 1 AND button = 1 THEN inbutton
  1370. END SUB
  1371.  
  1372. SUB subhighlight
  1373.     COLOR high, back
  1374.     LOCATE lin, col
  1375.     PRINT SPACE$(1); LEFT$(sel$(sel, subsel), 1); MID$(sel$(sel, subsel), 2); SPACE$(1);
  1376. END SUB
  1377.  
  1378. SUB subline
  1379.     COLOR high, fore
  1380.     LOCATE lin, col
  1381.     PRINT SPACE$(1); LEFT$(sel$(sel, subsel), 1);
  1382.     COLOR back, fore
  1383.     PRINT MID$(sel$(sel, subsel), 2); SPACE$(1);
  1384.     COLOR fore, back
  1385.     PRINT CHR$(176);
  1386.     LOCATE 3, 1: PRINT sel$(sel, 10)
  1387. END SUB
  1388.  
  1389. SUB subwindow
  1390.     subsel = 1
  1391.     DO UNTIL sel$(sel, subsel) = ""       'pulls down menu window
  1392.         lin = subsel + 3
  1393.         subline
  1394.         subsel = subsel + 1
  1395.     LOOP
  1396.     LOCATE lin + 1, col + 1
  1397.     PRINT STRING$(LEN(sel$(sel, 1)) + 2, 176)'prints bottom window shadow
  1398.     totsubs = subsel - 1
  1399.     subsel = 1
  1400. END SUB
  1401.  
  1402. SUB timeout
  1403.      DO
  1404.       checkinput
  1405.       DO UNTIL sec >= start + 1
  1406.            sec = TIMER
  1407.       LOOP
  1408.       start = start + 1
  1409.       d1 = d1 + 1
  1410.       IF d1 = 10 THEN
  1411.            d2 = d2 + 1
  1412.            d1 = 0
  1413.       END IF
  1414.       IF d2 = 6 THEN
  1415.            d3 = d3 + 1
  1416.            d2 = 0
  1417.       END IF
  1418.       IF d3 = 10 THEN
  1419.            d4 = d4 + 1
  1420.            d3 = 0
  1421.       END IF
  1422.       IF d4 = 10 THEN d4 = 0
  1423.       d1$ = LTRIM$(STR$(d1)): d2$ = LTRIM$(STR$(d2))
  1424.       d3$ = LTRIM$(STR$(d3)): d4$ = LTRIM$(STR$(d4)):
  1425.       tottime$ = d4$ + d3$ + ":" + d2$ + d1$
  1426.       LOCATE 21, 42: PRINT tottime$;
  1427.      LOOP UNTIL in$ <> ""
  1428.      offtime$ = newtime$(TIME$)
  1429. END SUB
  1430.  
  1431. SUB viewdir
  1432.       dirhead
  1433.       y = 1: w = 1
  1434.       FOR x = 5 TO 24
  1435.         z = z + 1
  1436.         name1$ = SPACE$(20)
  1437.         name2$ = SPACE$(20)
  1438.         number1$ = SPACE$(15)
  1439.         number2$ = SPACE$(15)
  1440.         LSET name1$ = name$(z + dirpage)
  1441.         LSET name2$ = name$(z + 20 + dirpage)
  1442.         LSET number1$ = number$(z + dirpage)
  1443.         LSET number2$ = number$(z + 20 + dirpage)
  1444.         LOCATE x, 1: PRINT name1$; TAB(23); number1$; TAB(41); name2$; TAB(63); number2$;
  1445.       NEXT x
  1446.       prompt "[H] HELP             [Home]  [End]  [PgUp]  [PgDn]              [Esc] EXIT"
  1447. END SUB
  1448.  
  1449. SUB writedatafile
  1450.     prompt "Directory " + datafile$ + " modified."
  1451.     datafile = FREEFILE
  1452.     OPEN datafile$ FOR OUTPUT AS datafile
  1453.     WRITE #datafile, version, port$, tone$, initial$, prefix$, path$, fore, back, high, freq, mouseon
  1454.     FOR x = 1 TO numrecs
  1455.         WRITE #datafile, name$(x), number$(x)
  1456.     NEXT x
  1457.     CLOSE datafile
  1458. END SUB
  1459.  
  1460. SUB writescreen (indent)
  1461.     FOR x = 5 TO 24
  1462.         IF NOT l$(x) = "" THEN
  1463.         LOCATE x, indent: PRINT l$(x)
  1464.         l$(x) = ""
  1465.         END IF
  1466.     NEXT x
  1467. END SUB
  1468.  
  1469.